﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UserInterfaceLayer.User
{
    public partial class Persons : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccessLayer.linqDatabaseDataContext db = new DataAccessLayer.linqDatabaseDataContext();
            lvPersons.DataSource = BusinessLogicLayer.DataObject.Person.Convert(DataAccessLayer.Person.ToList_IncludeDeleted(db));
            lvPersons.DataBind();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DataAccessLayer.linqDatabaseDataContext db = new DataAccessLayer.linqDatabaseDataContext();
            string FirstName = txtFirstName.Text;
            string LastName = txtLastName.Text;
            string NationalNumber = txtNationalNumber.Text;
            lvPersons.DataSource = BusinessLogicLayer.DataObject.Person.Convert(DataAccessLayer.Person.ToList_IncludeDeleted_Filter(db, FirstName, LastName, NationalNumber));
            lvPersons.DataBind();
        }
    }
}